<#assign base=request.contextPath />
<#assign oneLabel="系统管理">

<#assign twoLabel="管理员管理">
<#assign twoUrl=base+"/role/list">

<#assign leafLabel="管理员列表">
<!DOCTYPE html>
<html lang="en">
<head>
	<link rel="stylesheet" href="${base}/static/assets/css/chosen.css" />
 	<#include "/commons/headImport.ftl">
</head>
<body>
<#include "/commons/header.ftl">
<form class="form-horizontal" role="form" name="formName">
<div class="row">
    <div class="col-xs-12">
        <div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">用户名 </label>
            <div class="col-sm-4">
                <input type="text" name="qusername" value="${queryDO.qusername!''}" class="col-xs-10 col-sm-10" />
            </div>
			<label class="col-sm-2 control-label no-padding-right" for="form-field-1">真实姓名 </label>
            <div class="col-sm-4">
                <input type="text" name="qtrueName" value="${queryDO.qtrueName!''}" class="col-xs-10 col-sm-10" />
            </div>
        </div>
        <div class="space-4"></div>
        
        <div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">部门</label>
            <div class="col-sm-4">
				<select class="col-xs-10 col-sm-10 dept-chosen-select" name="qdeptId" id="dept-select">
                    <option value="">--请选择--</option>
				</select>
                <input type="hidden" id="dep_list_id" value="${queryDO.qdeptId!''}">
            </div>
			<label class="col-sm-2 control-label no-padding-right">职位</label>
            <div class="col-sm-4">
				<select class="col-xs-10 col-sm-10 job-chosen-select" name="qjobId" id="job-select">
                    <option value="">--请选择--</option>
				</select>
                <input type="hidden" id="job_list_id" value="${queryDO.qjobId!''}">
            </div>
        </div>
		<div class="space-4"></div>
		
        <div class="form-group">
			<label class="col-sm-2 control-label no-padding-right">状态</label>
            <div class="col-sm-4">
            	<@spring.formSingleSelect "queryDO.qstatus" statusMap 'class="col-sm-6 u-chosen-select"'/>
            </div>
            <div class="col-sm-6 orm-group center">
                <button class="btn btn-xs btn-success" type="button" id="search_id" url="${base}/user/list">
                    <i class="icon-search icon-on-right bigger-110"></i>查询
                </button>
                <button class="btn btn-xs" type="reset" id="reset_id" url="${base}/user/list">
                    <i class="icon-undo bigger-110"></i>重置
                </button>
            </div>
        </div>
        <div class="space-4"></div>
        
        <div class="table-responsive">
            <p>
            <@shiro.hasPermission name="/user/add">
                <button class="btn btn-minier btn-success" id="to_add_id" url="${base}/user/add">
                    <i class="icon-plus bigger-110"></i>新增管理员
                </button>
            </@shiro.hasPermission>
            </p>

            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                <thead>
	                <tr>
	                    <th class="center"></th>
	                    <th>用户名</th>
	                    <th>真实姓名</th>
	                    <th>电子邮箱</th>
	                    <th>状态</th>
	                    <th>部门</th>
	                    <th>职位</th>
	                    <th><i class="icon-time bigger-110 hidden-480"></i>创建时间</th>
	                    <th></th>
	                </tr>
                </thead>

                <tbody>
                <#if pr??>
                    <#list pr.data as user>
                    <tr>
                        <td class="center">${user_index+1}</td>
                        <td>${user.username}</td>
                        <td>${user.trueName}</td>
                        <td>${user.email}</td>
                        <td>
                        	<#if user.status==1>
                        		<span class="label label-success arrowed-in arrowed-in-right">正常</span>
                        	<#else>
                        		<span class="label label-danger arrowed">禁用</span>
                        	</#if>
                        </td>
                        <td>${user.deptDO.name}</td>
                        <td>${user.jobDO.name}</td>
                        <td>${user.gmtCreate?string('yyyy-MM-dd HH:mm:ss')}</td>
                        <td>
							<div class="visible-md visible-lg hidden-sm hidden-xs btn-group">
							<@shiro.hasPermission name="/user/get">
								<a class="btn btn-minier btn-info" href="javascript:get('${base}/user/get/${user.id}');" title="查看">
									<i class="icon-search bigger-120"></i>详情
								</a>
							</@shiro.hasPermission>
							<@shiro.hasPermission name="/user/edit">
                                <a class="btn btn-minier btn-success" href="javascript:get('${base}/user/edit/${user.id}');" title="编辑">
                                    <i class="icon-edit bigger-120"></i>编辑
                                </a>
							</@shiro.hasPermission>
							<@shiro.hasPermission name="/user/bind">													
								<a class="btn btn-minier btn-success" href="javascript:get('${base}/user/bind/${user.id}');" title="授权">
									<i class="icon-user bigger-120"></i>授权
								</a>
							</@shiro.hasPermission>
							<@shiro.hasPermission name="/user/updateStatus">
								<a class="btn btn-minier btn-success" href="javascript:get('${base}/user/updateStatus/${user.id}/<#if user.status==0>1<#else>0</#if>');" title="启用/禁用">
									<i class="icon-exchange bigger-120"></i><#if user.status==1>禁用<#else>启用</#if>
								</a>
							</@shiro.hasPermission>
							<@shiro.hasPermission name="/user/delete">
								<a class="btn btn-minier btn-danger id-btn-dialog2" data='({"url":"${base}/user/delete/${user.id}","form":"userFormName"})' href="javascript:void(0);" title="删除">
									<i class="icon-trash bigger-120"></i>删除
								</a>
							</@shiro.hasPermission>
							</div>
                        </td>
                    </tr>
                    </#list>
                </#if>
				<#if ((pr.data)?size==0)>
					<tr>
						<td colspan="10" class="center">没有查询任何数据</td>
					</tr>
				</#if>
                </tbody>
            </table>
			
			<@p.p pageParam=pr toURL="${base}/user/list" formName="formName"/>
        </div><!-- /.table-responsive -->
    </div><!-- /span -->
</div><!-- /row -->

<#include "/commons/footer.ftl">
<script src="${base}/static/assets/js/chosen.jquery.min.js"></script>
<script src="${base}/static/js/admin/user.js"></script>
</body>
</html>
